// This file is part of the ustl library, an STL implementation.
//
// Copyright (C) 2005 by Mike Sharov <msharov@users.sourceforge.net>
// This file is free software, distributed under the MIT License.
//
// utypes.h
//
// Types used by this library.
//

#ifndef UTYPES_H_118BBB3B50B7DBF22F5460C52E515C83
#define UTYPES_H_118BBB3B50B7DBF22F5460C52E515C83

#include <stl\config.h>

#ifdef __SYMBIAN32__
#include <sys\_types.h>
#include <e32std.h>
#endif

#ifndef STDC_HEADERS
    #error This library requires standard C and C++ headers to compile.
#endif
#define __STDC_LIMIT_MACROS	// For WCHAR_MIN and WCHAR_MAX in stdint.
#define __STDC_CONSTANT_MACROS	// For UINT??_C macros to avoid using L and UL suffixes on constants.
#ifdef HAVE_STDINT_H
    #include <stdint.h>
#elif HAVE_INTTYPES_H
    #include <inttypes.h>
#else

#include <limits.h>

#ifndef NULL
#define NULL 0
#endif

#ifndef _INT8_T_DECLARED
typedef	signed char	int8_t;
#define	_INT8_T_DECLARED
#endif

#ifndef _INT16_T_DECLARED
typedef	signed short int int16_t;
#define	_INT16_T_DECLARED
#endif

#ifndef _INT32_T_DECLARED
typedef	signed int int32_t;
#define	_INT32_T_DECLARED
#endif

#ifndef _INT64_T_DECLARED
typedef	long long int64_t;
#define	_INT64_T_DECLARED
#endif

#ifndef _UINT8_T_DECLARED
typedef	unsigned char uint8_t;
#define	_UINT8_T_DECLARED
#endif

#ifndef _UINT16_T_DECLARED
typedef	unsigned short int uint16_t;
#define	_UINT16_T_DECLARED
#endif

#ifndef _UINT32_T_DECLARED
typedef	unsigned int uint32_t;
#define	_UINT32_T_DECLARED
#endif

#ifndef _UINT64_T_DECLARED
typedef	unsigned long long uint64_t;
#define	_UINT64_T_DECLARED
#endif

#ifndef _INTPTR_T_DECLARED
#define _INTPTR_T_DECLARED
typedef uint32_t        uintptr_t;
typedef int32_t			intptr_t;
#endif

#ifndef _SSIZE_T_DECLARED
#define	_SSIZE_T_DECLARED
typedef signed long ssize_t;
#endif

#define INT64_C(c)              (c ## LL)
#define UINT64_C(c)             (c ## ULL)

#define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */
#define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */

#define DBL_MAX           1.7976931348623157E+308
#define DBL_MIN           2.2250738585072014E-308
#define LDBL_MAX  DBL_MAX
#define LDBL_MIN  DBL_MIN

#define UINTPTR_MAX                    ULONG_MAX

#endif

#include <stddef.h>		// For ptrdiff_t, size_t
//#include <float.h>
#ifdef HAVE_SYS_TYPES_H
    #include <sys/types.h>
#endif
#ifndef SIZE_MAX
    #define SIZE_MAX		UINT_MAX
#endif
#if sun || __sun		// Solaris defines UINTPTR_MAX as empty.
    #undef UINTPTR_MAX
    #define UINTPTR_MAX		ULONG_MAX
#endif
#ifndef WCHAR_MAX
    #ifdef __WCHAR_MAX__
	#define WCHAR_MAX	__WCHAR_MAX__
    #else
	#define WCHAR_MAX	CHAR_MAX
    #endif
#endif
#ifdef HAVE_LONG_LONG
    #ifndef LLONG_MAX
	#define ULLONG_MAX	UINT64_C(0xFFFFFFFFFFFFFFFF)
	#define LLONG_MAX	INT64_C(0x7FFFFFFFFFFFFFFF)
	#define LLONG_MIN	ULLONG_MAX
    #endif
#endif
#ifndef BYTE_ORDER
    #define LITTLE_ENDIAN	USTL_LITTLE_ENDIAN
    #define BIG_ENDIAN		USTL_BIG_ENDIAN
    #define BYTE_ORDER		USTL_BYTE_ORDER
#endif

typedef size_t		uoff_t;		///< A type for storing offsets into blocks measured by size_t.
typedef uint32_t	hashvalue_t;	///< Value type returned by the hash functions.

#endif

